Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Spring Boot Interview Questions and Answers

Question: How to scan all the beans and package declarations in Spring Boot?
Answer:
Spring Boot application scans all the beans and package declarations when the application initializes. You need to add the @ComponentScan annotation for your class file to scan your components added in your project.
@ComponentScan
public class DemoApplication {
   public static void main(String[] args) {
      SpringApplication.run(DemoApplication.class, args);
   }
}
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook